#include <bits/stdc++.h>

#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define in read<int>()
#define lin read<ll>()
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using vec = vector < int >;
using veg = vector < pii >;

template < typename T > T read() {
	T x = 0; bool f = 0; char ch = getchar();
	while(!isdigit(ch)) f |= ch == '-', ch = getchar();
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = getchar();
	return f ? -x : x;
}

const int N = 5e4 + 10;
const int K = 18;
const ll INF = 1e18;
const int inf = 2e9;

template < typename T > void chkmax(T &x, const T &y) { x = x > y ? x : y; }
template < typename T > void chkmin(T &x, const T &y) { x = x < y ? x : y; }

int dep[N], fa[N], n, m, tot, dfn[N], mn[K + 1][N << 1], pw[K + 10], lg[N << 1]; ll tdep[N], ans = -INF;
veg G[N];

void dfs(int x, int p) {
	fa[x] = p; dep[x] = dep[p] + 1; mn[0][dfn[x] = ++tot] = x;
	for(auto v : G[x]) if(v.fi ^ p) tdep[v.fi] = tdep[x] + v.se, dfs(v.fi, x), mn[0][++tot] = x; 
}

int tmn(int x, int y) { return dep[x] < dep[y] ? x : y; }

void init() {
	rep(i, 2, tot) lg[i] = lg[i >> 1] + 1; pw[0] = 1; rep(i, 1, K) pw[i] = pw[i - 1] * 2;
	rep(k, 1, K) rep(i, 1, tot - pw[k] + 1) mn[k][i] = tmn(mn[k - 1][i], mn[k - 1][i + pw[k - 1]]);
}

int lca(int x, int y) { x = dfn[x]; y = dfn[y]; if(x > y) swap(x, y); int k = lg[y - x + 1]; return tmn(mn[k][x], mn[k][y - pw[k] + 1]); }
ll dist(int x, int y) { return tdep[x] + tdep[y] - 2 * tdep[lca(x, y)]; }

namespace case1 {
	const int N = :: N * 50;
	vector < pair < int, ll > > pot[N];
	int ndn, rt[N], ch[N][2];
	ll mx1[N], mx2[N], ldep;
	void pu(int x) { mx1[x] = max(mx1[ch[x][0]], mx1[ch[x][1]]), mx2[x] = max(mx2[ch[x][0]], mx2[ch[x][1]]); /*cerr << mx1[x] << " " << mx2[x] << endl;*/ }
	int merge(int x, int y, int l = 1, int r = n) {
		//cerr << "M : " << x << " " << y << endl;
		if(!x || !y) return x | y; if(l == r) return chkmax(mx1[x], mx1[y]), chkmax(mx2[x], mx2[y]), x;
		chkmax(ans, mx1[ch[x][0]] + mx2[ch[y][1]] - ldep); chkmax(ans, mx2[ch[x][1]] + mx1[ch[y][0]] - ldep);
		//cerr << "!" << ans << endl;
		int mid = l + r >> 1; ch[x][0] = merge(ch[x][0], ch[y][0], l, mid); ch[x][1] = merge(ch[x][1], ch[y][1], mid + 1, r);
		pu(x); return x;
	}
	void delt(int &x, int pos, int l = 1, int r = n) {
		if(!x) return; if(l == r) return x = 0, void(); int mid = l + r >> 1;
		if(pos <= mid) delt(ch[x][0], pos, l, mid);
		else delt(ch[x][1], pos, mid + 1, r);
		pu(x);
	}
	void upd(int &x, int pos, ll v1, ll v2, int l = 1, int r = n) {
		if(!x) x = ++ndn, mx1[x] = mx2[x] = -INF, ch[x][0] = ch[x][1] = 0; if(l == r) return chkmax(mx1[x], v1), chkmax(mx2[x], v2);
		int mid = l + r >> 1; if(pos <= mid) upd(ch[x][0], pos, v1, v2, l, mid);
		else upd(ch[x][1], pos, v1, v2, mid + 1, r); pu(x);
	}
	void dfs(int x, int p) {
		//	cerr << x << " ";
		for(auto v : G[x]) if(v.fi ^ p) dfs(v.fi, x), delt(rt[v.fi], dep[x]);
		ldep = tdep[x]; for(auto v : G[x]) if(v.fi ^ p) rt[x] = merge(rt[x], rt[v.fi]);
		for(auto v : pot[x]) {
			//cerr << "AD : " << x << " " << v.fi << " " << v.se << endl;
			int nd = 0; upd(nd, dep[v.fi], v.se, v.se + tdep[v.fi]); rt[x] = merge(rt[x], nd);
		}
		//cerr << "RT : " << x << " " << rt[x] << endl;
	}
	void solve() { mx1[0] = mx2[0] = -INF; dfs(1, 0); /*cerr << "T: " << ans << endl;*/ }
	void reset() { ndn = 0; rep(i, 1, n) rt[i] = 0, vector < pair < int, ll > >().swap(pot[i]); } 
}

namespace case2 {
	vector < tuple < int, int, ll > > pot[N];
	int vtk[N << 2], stk[N << 2], top, rt, cur, tot;
	struct poi { int v; ll w; poi(int _v = 0, ll _w = -INF) : v(_v), w(_w) { } };
	struct node { poi x, y; ll dis; node(poi _x = poi(), poi _y = poi(), ll _dis = -INF) : x(_x), y(_y), dis(_dis) { } } val[N];
	bool operator < (node a, node b) { return a.dis < b.dis; }
	bool operator > (node a, node b) { return a.dis > b.dis; }
	node calc(poi x, poi y) { ll res = x.w + y.w + dist(x.v, y.v); chkmax(ans, res / 2 - tdep[cur]); return node(x, y, res); }
	void merge(node &a, node &b) {
		if(a.dis == -INF) return a = b, b.dis = -INF, void(); if(b.dis == -INF) return;
		node c;
		if(cur ^ rt) { chkmax(c, calc(a.x, b.x)); chkmax(c, calc(a.x, b.y)); chkmax(c, calc(a.y, b.x)); chkmax(c, calc(a.y, b.y)); chkmax(c, max(a, b)); }
		a = c; b.dis = -INF; 
	}
	void calc(const vector < tuple < int, int, ll > > &pot) {
		tot = 0;
		for(auto tv : pot) {
			int x, y; ll w; tie(x, y, w) = tv; vtk[++tot] = x; vtk[++tot] = y;
			poi a = poi(y, w + tdep[x]), b = poi(x, w + tdep[y]);
			node u(a, a, a.w << 1), v(b, b, b.w << 1);
			merge(val[cur = x], u); merge(val[cur = y], v);
		} 
		sort(vtk + 1, vtk + tot + 1, [](auto a, auto b) { return dfn[a] < dfn[b]; });
		tot = unique(vtk + 1, vtk + tot + 1) - vtk - 1;
		stk[top = 1] = 1;
		rep(i, 1, tot) {
			int x = vtk[i], L = lca(x, stk[top]);
			while(top > 1 && dep[L] <= dep[stk[top - 1]]) merge(val[cur = stk[top - 1]], val[stk[top]]), top--;
			if(L != stk[top]) merge(val[cur = L], val[stk[top]]), stk[top] = L;
			stk[++top] = x;
		}
		per(i, top - 1, 1) merge(val[cur = stk[i]], val[stk[i + 1]]); val[1].dis = -INF;
	}
	void solve() { rep(i, 1, n) if(pot[i].size() > 1) rt = i, calc(pot[i]); }
	void reset() { rep(i, 1, n) vector < tuple < int, int, ll > >().swap(pot[i]); }
}

void solve() {
	n = in; rep(i, 2, n) { int u = in, v = in, w = in; G[u].eb(v, w); G[v].eb(u, w); }
	dfs(1, 0); init(); m = in; 
	rep(i, 1, m) {
		int x = in, y = in, L = lca(x, y); ll v = lin, dis = dist(x, y); if(x == y) continue;
		if(L ^ x) case1 :: pot[x].eb(L, dis - v);
		if(L ^ y) case1 :: pot[y].eb(L, dis - v);
		case2 :: pot[L].eb(x, y, dis - 2 * v);
	} case1 :: solve(); case2 :: solve(); ans <= -1e17 ? puts("F") : printf("%lld\n", ans); 
}

void Clear() { case1 :: reset(); case2 :: reset(); rep(i, 1, n) veg().swap(G[i]); tot = 0; ans = -INF; }

int main() {
#ifndef ONLINE_JUDGE
	//freopen("1.in", "r", stdin);
#endif
	//freopen("center.in", "r", stdin); freopen("center.out", "w", stdout);
	int T = in; while(T--) solve(), Clear();
	return 0;
}
